import http from "../utils/http.js"
const dongji ={
	  namespaced:true,
      state: {
		  noticeData:{},
		  newsData:{},
		  rulesData:{},
		  instructionData:{},
		  id:0,
		  showData:{},
	  },
	  mutations:{
		get:(state)=>{
		http({
			url:'/achievements/get',
		}).then((res)=>{
			if(res.data.code==200){
			let notice=res.data.data
			state.noticeData=notice.filter((currentValue )=>{
				return currentValue.notice_className=='公告通知';
			});
			state.newsData=notice.filter((currentValue )=>{
				return currentValue.notice_className=='公司新闻';
			});
			state.rulesData=notice.filter((currentValue )=>{
				return currentValue.notice_className=='规章制度';
			});
			state.instructionData=notice.filter((currentValue )=>{
				return currentValue.notice_className=='办理指南';
			});
			}
		})	
		},
		setID:(state,value)=>{
			state.id=value;
		},
		show:(state)=>{
			http({
				url:'/achievements/show',
				data:{
					id:state.id
				}
			}).then((res)=>{
				state.showData=res.data.data
				// console.log(state.showData);
				})
		}
	  }
}
export default dongji